package com.bjesc_b2c.app.appraiset.adapter;

import android.content.Context;
import android.view.View;

import com.bjesc_b2c.app.appraiset.R;

import java.util.List;

import app.pinggushi.bjesc.com.baserecyclerview.adapter.CommonAdapter;
import app.pinggushi.bjesc.com.baserecyclerview.adapter.base.ViewHolder;
import master_bean.SelectColorBean;

import static android.view.View.GONE;

/**
 * Created by Jason Chen on 2017/2/22.
 */

public class SelectColorAdapter extends CommonAdapter<SelectColorBean> {
    public SelectColorAdapter(Context context, int layoutId, List<SelectColorBean> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void convertView(ViewHolder holder, SelectColorBean selectColorBean, int position) {
        holder.setText(R.id.tv_color_name, selectColorBean.getColorName());
        holder.setBackgroundDrawable(R.id.tv_color, mContext.getResources().getDrawable(selectColorBean.getDrawableColorId()));
        if (selectColorBean.isVisiable()) {
            holder.getView(R.id.iv_checked).setVisibility(View.VISIBLE);
            holder.setTextColorRes(R.id.tv_color_name, R.color.colorFFFF7900);
        } else {
            holder.getView(R.id.iv_checked).setVisibility(GONE);
            holder.setTextColorRes(R.id.tv_color_name, R.color.colorFF030303);
        }
    }

}
